/*     */ package com.feeyin.radar.sys.service.impl;
/*     */ 
/*     */ import com.feeyin.radar.sys.dao.DataDictionaryDAO;
/*     */ import com.feeyin.radar.sys.form.DictionaryForm;
/*     */ import com.feeyin.radar.sys.model.DataDictionary;
/*     */ import com.feeyin.radar.sys.service.DataDictionaryService;
/*     */ import java.util.List;
/*     */ 
/*     */ public class DataDictionaryServiceImpl
/*     */   implements DataDictionaryService
/*     */ {
/*     */   private DataDictionaryDAO dataDictionaryDAO;
/*     */ 
/*     */   public DataDictionaryDAO getDataDictionaryDAO()
/*     */   {
/*  19 */     return this.dataDictionaryDAO;
/*     */   }
/*     */ 
/*     */   public void setDataDictionaryDAO(DataDictionaryDAO dataDictionaryDAO) {
/*  23 */     this.dataDictionaryDAO = dataDictionaryDAO;
/*     */   }
/*     */ 
/*     */   public List getCustomerDictionarys() {
/*  27 */     return this.dataDictionaryDAO.getDataDictionarysByRecordType("1");
/*     */   }
/*     */ 
/*     */   public List getLinkmanDictionarys() {
/*  31 */     return this.dataDictionaryDAO.getDataDictionarysByRecordType("2");
/*     */   }
/*     */ 
/*     */   public List getOtherDictionarys() {
/*  35 */     return this.dataDictionaryDAO.getDataDictionarysByRecordType("3");
/*     */   }
/*     */ 
/*     */   public DataDictionary getDataDictionary(Integer id) {
/*  39 */     return this.dataDictionaryDAO.getDataDictionary(id);
/*     */   }
/*     */ 
/*     */   public boolean updateCustomerDictionarySet(String[] selectIds, DictionaryForm dictionaryForm, int language)
/*     */   {
/*  44 */     if (dictionaryForm == null) return false;
/*     */ 
/*  46 */     if ((selectIds != null) && (selectIds.length > 0)) {
/*  47 */       this.dataDictionaryDAO.updateDataDictionaryStatusByRecordType("1");
/*  48 */       for (int i = 0; i < selectIds.length; i++) {
/*  49 */         DataDictionary dataDic = new DataDictionary();
/*  50 */         dataDic.setId(Integer.valueOf(Integer.parseInt(selectIds[i])));
/*  51 */         dataDic.setStatus("1");
/*  52 */         this.dataDictionaryDAO.updateDataDictionaryStatus(dataDic);
/*     */       }
/*     */     }
/*     */ 
/*  56 */     Integer[] ids = dictionaryForm.getId();
/*  57 */     String[] currentRecords = dictionaryForm.getCurrentRecord();
/*  58 */     String[] recordDescs = dictionaryForm.getRecordDesc();
/*     */ 
/*  60 */     if ((ids == null) || (ids.length <= 0)) return false;
/*  61 */     if ((currentRecords == null) && (recordDescs == null)) return false;
/*  62 */     for (int i = 0; i < ids.length; i++) {
/*  63 */       DataDictionary dataDictionary = new DataDictionary();
/*  64 */       dataDictionary.setId(ids[i]);
/*     */ 
/*  66 */       if (language == 2) {
/*  67 */         if (currentRecords != null) {
/*  68 */           dataDictionary.setCurrentRecordEn(currentRecords[i]);
/*     */         }
/*  70 */         if (recordDescs != null)
/*  71 */           dataDictionary.setRecordDescEn(recordDescs[i]);
/*     */       }
/*     */       else {
/*  74 */         if (currentRecords != null) {
/*  75 */           dataDictionary.setCurrentRecord(currentRecords[i]);
/*     */         }
/*  77 */         if (recordDescs != null) {
/*  78 */           dataDictionary.setRecordDesc(recordDescs[i]);
/*     */         }
/*     */       }
/*  81 */       this.dataDictionaryDAO.updateDataDictionary(dataDictionary);
/*     */     }
/*  83 */     return true;
/*     */   }
/*     */ 
/*     */   public boolean updateLinkmanDictionarySet(String[] selectIds, DictionaryForm dictionaryForm, int language)
/*     */   {
/*  88 */     if (dictionaryForm == null) return false;
/*     */ 
/*  90 */     if ((selectIds != null) && (selectIds.length > 0)) {
/*  91 */       this.dataDictionaryDAO.updateDataDictionaryStatusByRecordType("2");
/*  92 */       for (int i = 0; i < selectIds.length; i++) {
/*  93 */         DataDictionary dataDic = new DataDictionary();
/*  94 */         dataDic.setId(Integer.valueOf(Integer.parseInt(selectIds[i])));
/*  95 */         dataDic.setStatus("1");
/*  96 */         this.dataDictionaryDAO.updateDataDictionaryStatus(dataDic);
/*     */       }
/*     */     }
/*     */ 
/* 100 */     Integer[] ids = dictionaryForm.getId();
/* 101 */     String[] currentRecords = dictionaryForm.getCurrentRecord();
/* 102 */     String[] recordDescs = dictionaryForm.getRecordDesc();
/*     */ 
/* 104 */     if ((ids == null) || (ids.length <= 0)) return false;
/* 105 */     if ((currentRecords == null) && (recordDescs == null)) return false;
/* 106 */     for (int i = 0; i < ids.length; i++) {
/* 107 */       DataDictionary dataDictionary = new DataDictionary();
/* 108 */       dataDictionary.setId(ids[i]);
/*     */ 
/* 110 */       if (language == 2) {
/* 111 */         if (currentRecords != null) {
/* 112 */           dataDictionary.setCurrentRecordEn(currentRecords[i]);
/*     */         }
/* 114 */         if (recordDescs != null)
/* 115 */           dataDictionary.setRecordDescEn(recordDescs[i]);
/*     */       }
/*     */       else {
/* 118 */         if (currentRecords != null) {
/* 119 */           dataDictionary.setCurrentRecord(currentRecords[i]);
/*     */         }
/* 121 */         if (recordDescs != null) {
/* 122 */           dataDictionary.setRecordDesc(recordDescs[i]);
/*     */         }
/*     */       }
/* 125 */       this.dataDictionaryDAO.updateDataDictionary(dataDictionary);
/*     */     }
/* 127 */     return true;
/*     */   }
/*     */ 
/*     */   public boolean updateOtherDictionarySet(DictionaryForm dictionaryForm, int language)
/*     */   {
/* 132 */     Integer[] ids = dictionaryForm.getId();
/* 133 */     String[] recordDescs = dictionaryForm.getRecordDesc();
/*     */ 
/* 135 */     if ((ids == null) || (ids.length <= 0)) return false;
/* 136 */     if (recordDescs == null) return false;
/* 137 */     for (int i = 0; i < ids.length; i++) {
/* 138 */       DataDictionary dataDictionary = new DataDictionary();
/* 139 */       dataDictionary.setId(ids[i]);
/*     */ 
/* 141 */       if (language == 2) {
/* 142 */         if (recordDescs != null) {
/* 143 */           dataDictionary.setRecordDescEn(recordDescs[i]);
/*     */         }
/*     */       }
/* 146 */       else if (recordDescs != null) {
/* 147 */         dataDictionary.setRecordDesc(recordDescs[i]);
/*     */       }
/*     */ 
/* 150 */       this.dataDictionaryDAO.updateDataDictionary(dataDictionary);
/*     */     }
/* 152 */     return true;
/*     */   }
/*     */ }

/* Location:           C:\Users\e547415\MyProject\rone\WEB-INF\classes\
 * Qualified Name:     com.feeyin.radar.sys.service.impl.DataDictionaryServiceImpl
 * JD-Core Version:    0.6.0
 */